import { InputNumber} from "antd";
import FormItem from "antd/es/form/FormItem";
import {CommonComponentProps} from "../../../../components/editor/interface.ts";
import {useDrag} from "react-dnd";
import {CSSProperties} from "react";
import {removeSetter} from "../../../utils/removeSetter.ts";
import {MoveDrop} from "../../../hooks/useMoveDrop.tsx";
export interface InputNumberProps extends CommonComponentProps {
    id: number;
    name: string;
    styles?: CSSProperties;
    parentId: number;
    children?: any;
    label:any
    type:any,
}
const InputNumberDev = (props:InputNumberProps) => {
    const {id,name} = props
    const [_,drag] = useDrag({
        type:"InputNumber",
        item:{
            id:props.id,
            type:props.name,
            dragType: "move"
        }
    })
    const ComponentProps = removeSetter({...props},["children","parentId"])

    return (
        <div className={'relative'}  data-component-id={props.id} style={props.styles} ref={drag}>
            <MoveDrop key={name} dropComponentId={id} parentId={props.parentId}  />
            <FormItem>
                <FormItem  label={props.label} name={props.name} rules={props.rule} style={{margin:"0",...props.styles}}>
                    <InputNumber placeholder={props.placeholder} {...ComponentProps}/>
                </FormItem>
            </FormItem>
        </div>
    );
};

export default InputNumberDev;